package com.yjt.fresh.activity;

import android.view.View;
import android.webkit.WebView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.yjt.fresh.R;
import com.yjt.fresh.base.BaseSimpleActivity;
import com.yjt.fresh.constant.MyConstants;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 帮助中心 问题详情
 * Created by mcc on 2018/7/21.
 */

public class AtyHelpQuestionDetail extends BaseSimpleActivity {
    @BindView(R.id.back)
    RelativeLayout mBack;
    @BindView(R.id.tvAppAtyTitleAndContentTitle)
    TextView mTvTitle;
    @BindView(R.id.wbAppAtyTitleAndContent)
    WebView mWb;

    @Override
    protected int getContentView() {
        return R.layout.app_aty_title_content;
    }

    @Override
    protected void initViews() {
        ButterKnife.bind(this);
        mTvTitle.setText(getIntent().getStringExtra(MyConstants.HELP_CENTER_TITLE));
        String content = getIntent().getStringExtra(MyConstants.HELP_CENTER_CONTENT);
        setWebView(content);

    }

    @Override
    protected void initEvent() {

        mBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    private void setWebView(String content) {
        mWb.getSettings().setUseWideViewPort(true);
        mWb.getSettings().setDisplayZoomControls(false); //隐藏原生的缩放控件
        mWb.loadDataWithBaseURL(null, content, "text/html", "utf-8", null);
    }
}
